home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / alph100p.zip / ALPHA.DOC < prev    next >
Text File  |  1991-11-02  |  47KB  |  1,160 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.          ╔══════════════════════════════════════════════════════════╗
  15.          ║                         A L P H A                        ║
  16.          ║               A Turbo Pascal ver 6.0 TPU Unit            ║
  17.          ║                                                          ║
  18.          ║             Copyrighted (C) John H. Gohde, 1991          ║
  19.          ║                    All Rights Reserved                   ║
  20.          ║                                                          ║
  21.          ║           ShareWare licensed for trial use only.         ║
  22.          ╚══════════════════════════════════════════════════════════╝
  23.  
  24.     Page 1                                                       11-02-91
  25.  
  26.  
  27.      INTRODUCTION
  28.  
  29.           ALPHA is a Turbo Pascal  version 6.0 Unit that provides
  30.           support for enhanced COLOR TEXT screen operations.
  31.  
  32.           ALPHA provides direct functional replacements for video
  33.           statements found in  the CRT unit. It is  the second of
  34.           four units  designed to replace  the CRT unit.  It also
  35.           contains  over  40  additional  new commands, including
  36.           support  for Video  Paging or  allows redirection  with
  37.           COLOR. It contains something of interest for everyone.
  38.  
  39.           ALPHA  was designed  to  make  the problem  of assuring
  40.           compatibility with ALL MONO,  CGA, EGA and VGA adapters
  41.           as transparent to the programmer as possible
  42.  
  43.           The enclosed  ALPHA unit requires  Turbo Pascal version
  44.           6.0, which is not included.
  45.  
  46.      COPYRIGHT NOTICE
  47.  
  48.           Both the software and its documentation are copyrighted
  49.           materials.  I  reserve  all  rights  to these materials
  50.           under  United  States  law  and international copyright
  51.           conventions  which  are  not  expressly  granted to the
  52.           user.  No part  of this  material may  be reproduced or
  53.           modified in any way without my prior, expressed written
  54.           permission. This  document is NOT Public  Domain. It is
  55.           intended  as an  informational document  for evaluative
  56.           purposes and for use by Registered users. This Document
  57.           may be copied in whole for that intent only.
  58.  
  59.  
  60.      DISCLAIMER
  61.  
  62.           I EXPRESSLY  DISCLAIM ALL WARRANTIES  INCLUDING BUT NOT
  63.           LIMITED TO  THE WARRANTIES OF FITNESS  FOR A PARTICULAR
  64.           PURPOSE AND MERCHANTABILITY. YOU  USE BOTH THE SOFTWARE
  65.           AND DOCUMENTATION AT YOUR OWN RISK!
  66.  
  67.  
  68.      TRADEMARKS
  69.  
  70.           Turbo  Pascal  and  all   other  Borland  products  are
  71.           trademarks   or   registered   trademarks   of  Borland
  72.           International,  Inc..  Portions  of  the enclosed Turbo
  73.           Pascal unit(s) are Copyrighted (C) 1983,1990 by Borland
  74.           International  as  it/they  were  compiled  with  Turbo
  75.           Pascal.
  76.  
  77.           Any  other brand  or products  names mentioned  in this
  78.           document  are  trademarks  or  registered trademarks of
  79.           their respective holders.
  80.  
  81.     Page 2                                                       11-02-91
  82.  
  83.  
  84.      SHAREWARE LICENSE
  85.  
  86.           GRANT OF LIMITED LICENSE: You  may use one copy of this
  87.           software  on a  single terminal  connected to  a single
  88.           computer for a maximum of  30 days for the sole purpose
  89.           of determining suitability for your intended use.
  90.  
  91.           In other words,  I am allowing you to  use/test my unit
  92.           for a thirty day trial period. Use of my unit in any of
  93.           your personal programs  requires registration. Further,
  94.           commercial  use   of  any  of  my   units  requires  an
  95.           additional  one time  registration fee  as a commercial
  96.           user.
  97.  
  98.  
  99.      SHAREWARE NOTICE
  100.  
  101.           ALPHA is NOT public domain software.
  102.  
  103.           For continued use of my unit, EVALUATORS must register!
  104.  
  105.           This is true ShareWare. This means that what you see is
  106.           what you get. There is  no Registered version! In order
  107.           to ask  for the absolutely lowest  donation possible, I
  108.           am  not requesting  that you  pay for  the shipping and
  109.           handling  required  by  a  registered  diskette. Hence,
  110.           ALPHA is fully functional.
  111.  
  112.           You are  required to purchase  a copy of  this software
  113.           for use beyond this 30  day evaluation period. One copy
  114.           must be purchased for  each computer, cpu, terminal, or
  115.           work station.
  116.  
  117.           TEST OF PURCHASE: Possession  of this software for more
  118.           than 30 days  or use of this software  on more than one
  119.           computer  or use  in ANY  of your  programs renders you
  120.           liable for the current purchase  price for each copy in
  121.           use or in your possession.  NOTICE: I have provided for
  122.           a way of detecting its use in any TP program!!!
  123.  
  124.  
  125.      HOW TO REGISTER
  126.  
  127.           To register  simply fill out  the attached registration
  128.           form (REGISTER.FRM) and send it with payment to:
  129.  
  130.                    John H. Gohde
  131.                    ALPHA
  132.                    P O Box 17581
  133.                    Richmond, VA  23226
  134.  
  135.     Page 3                                                       11-02-91
  136.  
  137.  
  138.      BACKGROUND INFORMATION
  139.  
  140.           Due  to the  perceived negative  side effects  (whether
  141.           real or  imagined) of Borland's CRT  Unit, I decided to
  142.           write a functional replacement.
  143.  
  144.           Not  having purchased  the Run  Time Library,  I simply
  145.           started  duplicating the  various functions  in my  own
  146.           unit.  It  soon  became  apparent,  that  the  CRT unit
  147.           actually covered  several functional areas.  Further, I
  148.           realized  that each  area could  also be  significantly
  149.           enhanced with features not  found in Borland's original
  150.           unit.
  151.  
  152.           Hence, I actually ended up developing a family of units
  153.           to replace Borland's CRT Unit. This family of units are
  154.           as follows:  WOW, ALPHA, KEY,  and MOUSE. The  WOW unit
  155.           provides  the  miscellaneous   functions  with  minimal
  156.           overhead.  The  ALPHA  unit  offers  support for simple
  157.           non-direct video COLOR TEXT  screen operations. The KEY
  158.           unit offers support for  keyboard operations. The MOUSE
  159.           unit offers support for both two and three button mice.
  160.  
  161.           WOW is the  first unit of this family,  and is required
  162.           by ALL  my other units,  even those not  related to the
  163.           CRT unit.
  164.  
  165.           The  central theme  of this  family is  AlphaNumeric or
  166.           TEXT programming  using no direct video  writes and the
  167.           standard  InPut/OutPut functions  in a  manner that  is
  168.           compatible with multitasking environments.
  169.  
  170.           This family approach allows users to pick and chose the
  171.           specific  functions that  are actually  needed in their
  172.           programs. As  a result, users  who do not  need all the
  173.           functions of  all the units can  minimize program size.
  174.           (Each  unit  has  a  small  initialization section.) In
  175.           addition, Borland's smart linker will remove all unused
  176.           code and  data from your program.  Hence, the increased
  177.           functionality  of these  units will  not increase  your
  178.           program size unless you actually use those functions.
  179.  
  180.           This software  file contains the ALPHA  unit and a copy
  181.           of the  required WOW.TPU unit (WOW  is also distributed
  182.           separately  with complete  documentation.). (The  other
  183.           units  are packaged  separately.) It  also contains  as
  184.           little  source  code  as   possible.  This  package  is
  185.           intended   for   those   who   call  themselves  Pascal
  186.           Programmers rather than just a PC user.
  187.  
  188.     Page 4                                                       11-02-91
  189.  
  190.  
  191.           This unit does  not use OOPs. All the  routines are low
  192.           level and  can be easily  incorporated into Objects  of
  193.           your choice.
  194.  
  195.           This unit is NOT directly comparable to the CRT unit as
  196.           it  offers a  significant number  of advanced features,
  197.           such  as  auto  clean  up,  which  are  NOT provided by
  198.           Borland. ALPHA does NOT offer  small size as one of its
  199.           features. If size is of primary importance then I would
  200.           suggest using only my WOW unit.
  201.  
  202.  
  203.      SOURCE CODE
  204.  
  205.           The source code used in this Unit was written for Turbo
  206.           Pascal version 6.0+. Extensive use  was made of the new
  207.           built-in assembler.  As at least  90% of the  low-level
  208.           code is in the BASM  format; support for prior versions
  209.           of TP would require a major rewrite of the code (not to
  210.           mention my having to buy  a legal copy of same). Hence,
  211.           I have no plans for  supporting prior versions of Turbo
  212.           Pascal.
  213.  
  214.           Currently the source code  is not available. Frankly, I
  215.           would  not be  able to  guarantee at  this time  a fast
  216.           response  to any  software purchases. Any way,  I would
  217.           much  rather  be  developing  new  code  than  stuffing
  218.           envelops!!! Also, if source  code was available I would
  219.           also be asking for a lot more green.
  220.  
  221.           Once the total package has been distributed nationally,
  222.           through  several sources,  and the  companion Windowing
  223.           Package has  been likewise distributed, I  will be in a
  224.           good position  to determine if the  software design has
  225.           stabilized, or not. Right now I want to be able to make
  226.           design changes  as needed. Once, I  am satisfied on how
  227.           both  packages  work  together,  I  will  start selling
  228.           licenses to  use the source code(  ie, make source code
  229.           available).
  230.  
  231.           In  addition, please  consider  the  fact that  you are
  232.           currently using the CRT, DOS, and Printer units without
  233.           any source  code, either. Lack  of code hasn't  stopped
  234.           you from using the CRT unit;  has it? And, if you spent
  235.           $190  for  the  RTL,  well  you  probably  would not be
  236.           interested in ALPHA anyway.
  237.  
  238.           Nevertheless,  this  UNIT  is  supported  by  me.  (see
  239.           SUPPORT.DOC).  Any bug  fixes necessary,  will be  made
  240.           available for download /  FREQ from my support Bulletin
  241.           Board.  Registered  Users  are  entitled  to use future
  242.           updates to this UNIT  necessitated from future versions
  243.           of Turbo  Pascal; at NO additional charge, pursuant  to
  244.           our signed license agreement.
  245.  
  246.     Page 5                                                       11-02-91
  247.  
  248.  
  249.      COLOR AND THE EVILS OF CRT
  250.  
  251.           Users of ALPHA might decide  that it does not work with
  252.           color  the way  CRT  does.  Actually you  are comparing
  253.           apples with oranges! CRT also does not work with color,
  254.           once  you  turn  off  CRTs  so  called  evils.  Or more
  255.           precisely,  those  users  do  not  really  know how CRT
  256.           works; or are confused by how color actually functions.
  257.           (Run, also, the CRTDEMO and DEMO2 programs.)
  258.  
  259.           There are two so called  features/evils in the CRT unit
  260.           which  some users  object to  and eventually  turn off.
  261.           ALPHA does not contain these  evils so there is nothing
  262.           to turn  off. Also if  you are NOT  going to use  these
  263.           features, why  carry their overhead in  your program as
  264.           required by the CRT unit?
  265.  
  266.           In  all  fairness,  these  features  are  evils only in
  267.           AlphaNumeric,  Text,  or   TUI  programming.  As  these
  268.           features  are required  in graphic  or GUI programming,
  269.           there usefulness is relative to the type of programming
  270.           that you are doing. So  if you are primarily interested
  271.           in graphics, then ALPHA may not be for you.
  272.  
  273.           Evil  number  one  is  Direct  Video.  CRT  contains  a
  274.           DirectVideo boolean variable.  By Default this variable
  275.           is  set  to  true  with  CRT.  ALPHA  does not use this
  276.           variable. This means that CRT is designed for the WRITE
  277.           and WRITELN statements to  write directly to the screen
  278.           memory. ALPHA does NOT  write directly to video memory.
  279.           Instead  characters  are  displayed  using the standard
  280.           BIOS  output  functions.  This  fact  makes  ALPHA both
  281.           slower  and compatible  with Multitasking.  With todays
  282.           faster  CPUs /  Video Boards,  processing speed  is not
  283.           really  as noticeable  as it  was on  the original  PC.
  284.           However,  ALPHA  provides  for   paging  which  is  how
  285.           intelligent programmers can  make their programs appear
  286.           instantaneous using  ALPHA. Direct Video  writes do not
  287.           affect color.
  288.  
  289.           Because  CRT writes  directly to  video memory  it also
  290.           includes the CheckSnow boolean variable. ALPHA does NOT
  291.           use  this  variable  because  it  is  not  necessary!!!
  292.           Without direct  video updates Snow  on CGA adapters  is
  293.           not possible. Hence, your  programs need not even check
  294.           for this condition.
  295.  
  296.           The second  evil involves I/O redirection  of the INPUT
  297.           and OUTPUT  standard text files. With  the CRT unit I/O
  298.           redirection is no longer  possible unless the user adds
  299.           code  to  explicitly  assign  back  standard  input and
  300.           output. No additional code  is needed with ALPHA, since
  301.  
  302.     Page 6                                                       11-02-91
  303.  
  304.  
  305.           ALPHA uses ONLY standard input and output. So users who
  306.           want output  to be redirected using  the CRT unit; MUST
  307.           add extra code which is not required by ALPHA. However,
  308.           when  output  is  closed  with  the  CRT  unit both the
  309.           WRITELN  and  WRITE  statements  no  longer  work  with
  310.           Color!!! I suggest that  you try experimenting with the
  311.           CRT  unit to  verify what  happens. Don't  just take my
  312.           word for it.
  313.  
  314.           Obviously, the same thing happens with ALPHA. So if you
  315.           want both color and redirection  with the CRT unit what
  316.           option do  you have? ALPHA provides  for color with the
  317.           CGA_MODE option and the Echo statements.
  318.  
  319.  
  320.      COLOR
  321.  
  322.           You have a choice of 16 colors. But, after studying the
  323.           subject for  a while you should  actually STOP thinking
  324.           in terms of 16 colors. What you have is two versions of
  325.           only eight colors!!! There are eight colors: 0-7 plus a
  326.           highlighted version  of those same  colors. Or you  can
  327.           call them background (0-7) and foreground (highlighted)
  328.           colors.
  329.  
  330.  
  331.     REDIRECTION vs. Color vs. 16 BACKGROUND COLORS
  332.  
  333.           By Default only eight of  those 16 colors are available
  334.           for the  background. This allows for  blinking. The CRT
  335.           unit automatically works some  magic and enables you to
  336.           get 8  background colors on  a EGA. With  ALPHA you can
  337.           get ALL sixteen background colors  (even on a CGA), but
  338.           by choice only.
  339.  
  340.           First of all you have  to chose between blinking and 16
  341.           background colors.  You can not  have both at  the same
  342.           time. Next you have to decide how you are going to deal
  343.           with  users  using  a  CGA  monitor  versus those using
  344.           Ega/Vga.   This   package   touts   itself   as   being
  345.           multitasking  compatible. The  problem is  that the CGA
  346.           can  also use  16 background  colors but  only after  a
  347.           direct hardware write. This may cause some multitasking
  348.           problems. But, the choice is  once again yours (use the
  349.           MakeAlphaChoice  statement).  It   takes  place  rather
  350.           quickly, so it probably wont cause any problems.
  351.  
  352.  
  353.     Page 7                                                       11-02-91
  354.  
  355.  
  356.      MONOCHROME ADAPTERS
  357.  
  358.  
  359.           If  you want  your program  to function  on MONO or MDA
  360.           adapters than  you must either  not use video  pages or
  361.           code your  program so that it  processes video pages in
  362.           sequence; since MDA adapters only have one video page.
  363.  
  364.           With a MDA monitor installed, ALPHA will force all page
  365.           commands to  use the first  page. Updating video  pages
  366.           out  of sequence  will,  thus,  result in  your program
  367.           jumping around in a manner not intended by you.
  368.  
  369.           With a  MDA adapter installed all  color attributes are
  370.           filtered  by  ALPHA  to   only  three  values:  Normal,
  371.           Invisible, and  Reverse. This will allow  color to work
  372.           on a MDA. However, unless  you use more than JUST color
  373.           in your  programs users with  MONO monitors will  still
  374.           not be able to see what is  going on. So the use of the
  375.           IBM  extended character  set Box  drawing characters to
  376.           give some  substance to your program  screen images; is
  377.           highly recommended.
  378.  
  379.           Programmers also  have the option  of terminating their
  380.           program  if a  MDA  is  installed with  the TerminateOn
  381.           command.
  382.  
  383.  
  384.      VIDEO ADAPTER MODES
  385.  
  386.           BLACK AND WHITE MODE
  387.           --------------------
  388.           There is no Black and White  Mode or MONO mode. If this
  389.           is  what you  want than  you really  shouldn't be using
  390.           ALPHA  in your  program. My  WOW unit  will provide for
  391.           this mode. But, if you prefer to use ALPHA just be sure
  392.           NOT to use  the HighVideo, paging, or any  of the other
  393.           Color statements.
  394.  
  395.  
  396.           DEFAULT CGA_MODE
  397.           ----------------
  398.           The  default  mode  of  ALPHA  is  set  up  for the CGA
  399.           adapter.   This  means   eight  foreground   and  eight
  400.           background  colors.  Both   color  and  redirection  is
  401.           possible,  at  the  same  time.  And,  Standard  OutPut
  402.           remains  open.
  403.  
  404.     Page 8                                                       11-02-91
  405.  
  406.  
  407.           In this mode, any background color values that you code
  408.           in your program are filtered  out at run-time for users
  409.           with  a CGA  adapter by  subtracting 7  from background
  410.           color values  above seven. For EGA  and VGA users these
  411.           numbers are not filtered, but  the user still sees only
  412.           eight background colors (not 16).
  413.  
  414.           If you  only want to  use 8 background  colors then you
  415.           can use the Set8Color and Change8 commands and have the
  416.           TP compiler catch background color coding errors. These
  417.           commands also are faster.
  418.  
  419.  
  420.           EGA_MODE
  421.           --------
  422.           You can  put your program  in EGA mode  by selecting it
  423.           with  the  MakeAlphaChoice(EGA_MODE)  command  (ie,  at
  424.           start up). This means now  that EGA users and above can
  425.           now see 16 background colors  while CGA users are still
  426.           limited  to 8  colors. In  addition, redirection  is no
  427.           longer possible  as standard OutPut has  been closed by
  428.           ALPHA.
  429.  
  430.           CGA16_MODE
  431.           ----------
  432.           In this mode all users with a CGA and above adapter can
  433.           see 16 background colors.  This mode is not recommended
  434.           as it requires a direct  memory write and may interfere
  435.           with some  multitasking environments. You  would select
  436.           this mode with  the MakeAlphaChoice(Cga16_Mode) command
  437.           at the start of your program.
  438.  
  439.           VGA MODE
  440.           --------
  441.           ALPHA has  no VGA mode.  However you can  first execute
  442.           TextMode(EgaVga) in your program to get 43 rows on your
  443.           screen.   To   get   50   rows   follow   up  with  the
  444.           SetEgaRows(at50)  command.  These  commands  ignore all
  445.           adapters below the EGA.
  446.  
  447.     Page 9                                                       11-02-91
  448.  
  449.  
  450.     WINDOWS
  451.  
  452.           ALPHA  does not  support windows.  After releasing  the
  453.           complete  CRT  replacement  package,  I  will develop a
  454.           Windowing package that is compatible with ALPHA. But at
  455.           present it  does not exist. No  reason why you couldn't
  456.           write you own Windowing routines, however.
  457.  
  458.           But don't confuse windows with pages. They are entirely
  459.           two different things. Windows  take up valuable CPU RAM
  460.           and Video Pages do not!!!
  461.  
  462.           Windows  usually cover  only part  of a  screen while a
  463.           video page always includes the entire screen.
  464.  
  465.  
  466.      PAGES
  467.  
  468.           Video Pages use Video Ram which is contained within the
  469.           video adapter not the system board. Hence it is another
  470.           way to  squeeze extra memory  out of a  computer. Also,
  471.           you can use a video page  as a means of saving a screen
  472.           with  only  marginal  programming  overhead.  Hence, by
  473.           using Video  Pages your program code  size can actually
  474.           be smaller and your program  can actually use less user
  475.           RAM.   (However,  in   multitasking  environments  your
  476.           program might  end up using CPU  RAM.) The Video Paging
  477.           feature of ALPHA will work in multitasking environments
  478.           because  no direct  video writes  are made.  ALL screen
  479.           updates are  performed with the  standard BIOS function
  480.           calls.
  481.  
  482.           ALPHA FILTERING
  483.           ---------------
  484.           With a  MDA or MONO  adapter installed all  pages above
  485.           the first page are filtered out. Therefore, you have to
  486.           see to two it that you  update date the hidden pages in
  487.           sequence, as  MDA  users  will not  have  hidden pages.
  488.           (While a  major complication could  have been added  to
  489.           ALPHA to simulate video pages  for MDA users that would
  490.           have only added to the overhead burden of CGA and above
  491.           class users.)
  492.  
  493.           With a CGA adapter installed all pages above the fourth
  494.           page are filtered out by subtracting 4 from pages fifth
  495.           and above.
  496.  
  497.     Page 10                                                      11-02-91
  498.  
  499.  
  500.           No check  is actually made to  determine how many Pages
  501.           an installed  adapter is capable  of supporting. It  is
  502.           simply assumed  that MDA's supports  one and CGA's  and
  503.           above support 4 video pages.
  504.  
  505.           One  uses Video  pages as  a means  to develop  screens
  506.           hidden  from a  user with  the SetPage  and PreparePage
  507.           commands.   Once   completed   they   can   be  flashed
  508.           instantaneously  to  a   user  with  the  SetActivePage
  509.           command.  Hence you  use video  pages to  speed up  the
  510.           apparent speed of your program, or in lieu of windows.
  511.  
  512.           Each  of  the  eight  video  pages  has  its own cursor
  513.           position and cursor shape. However, all the video pages
  514.           share the same TextAttr variable.
  515.  
  516.  
  517.      PROGRAMMER DECISIONS
  518.  
  519.           INSTALLED ADAPTER DECISIONS
  520.           ---------------------------
  521.           If  your program  must terminate  if a  user is using a
  522.           certain kind of Video  Adapter than use the TerminateOn
  523.           statement  at  program  start  up  or  write  your  own
  524.           termination routine.
  525.  
  526.           The following decisions are made by the programmer with
  527.           the MakeAlphaChoice command.
  528.  
  529.  
  530.           REDIRECTION AND COLOR DECISIONS
  531.           -------------------------------
  532.           Must the program have redirection?
  533.  
  534.                A) YES
  535.                   Either you  will use just WOW  or you will have
  536.                   to select the CGA_MODE option. In addition, you
  537.                   can only  use the First  Video Page (  ie, don't
  538.                   use any page commands ) with the Echo commands.
  539.  
  540.                B) NO
  541.                   Must the program have COLOR?
  542.  
  543.                   1. NO
  544.                      Use either just WOW or select CGA_MODE.
  545.  
  546.                   2. YES
  547.                      Must the program use 16 background colors?
  548.  
  549.     Page 11                                                      11-02-91
  550.  
  551.  
  552.                      A) NO
  553.                         Select the CGA_MODE  option and use the
  554.                         Set8Colors and Change8 commands.
  555.  
  556.                      B) YES
  557.                         Must  installed  CGA   adapters  have  16
  558.                         background colors?
  559.  
  560.                         1. NO
  561.                            Select the EGA_MODE option and use the
  562.                            SetColors and Change commands.
  563.  
  564.                         2. YES
  565.                            Select  the CGA16_MODE  option and use
  566.                            the SetColors and Change commands.
  567.  
  568.  
  569.                EXIT PROCEDURE DECISIONS
  570.                ------------------------
  571.                Are  you going  to write  your own  Video clean up
  572.                procedure?
  573.  
  574.                    A) NO
  575.                       Are  you  going  to  write  your  own  Main
  576.                       Program  Exit  Procedure?  (A  Main Program
  577.                       Exit  Procedure  is  required  to  leave  a
  578.                       parting comment to your users.)
  579.  
  580.                          1. YES
  581.                             Select the No_MainExit Option.
  582.  
  583.                          2. NO
  584.                             Code  your parting user comments.
  585.  
  586.  
  587.                    B) YES
  588.                       Select the No_AlphaExit option.
  589.  
  590.     Page 12                                                      11-02-91
  591.  
  592.  
  593.      TEMPLATE.PAS
  594.  
  595.           The  attached  file  called  TEMPLATE.PAS  contains the
  596.           suggested format of all  programs using ALPHA. I should
  597.           emphasis, however, that any format may be used, as long
  598.           as you know what you are doing.
  599.  
  600.  
  601.      ALPHADEMO.PAS
  602.  
  603.           The  attached  file  called  ALPHADEMO.PAS  is a sample
  604.           program that does not use  the CRT unit and illustrates
  605.           some of the  features of ALPHA as well  as document how
  606.           some of new commands are  also used. I suggest that you
  607.           study this program closely.
  608.  
  609.           I have  verified that it  works on MONO,  CGA, and VGA
  610.           adapters, as is.
  611.  
  612.  
  613.      NORMVIDEO - LOWVIDEO - HIGHVIDEO
  614.  
  615.           Indiscriminate   use   of   the   LowVideo,  HighVideo,
  616.           NormVideo  statements  and  changing  program  modes in
  617.           order  to high  light certain  text should  be avoided.
  618.           Text highlighting  can be accomplished  either with the
  619.           ReversColorXY or Change color statements.
  620.  
  621.  
  622.      WORKING WITH, NOT AGAINST, ALPHA
  623.  
  624.           The reason  why you are  going to use  ALPHA is because
  625.           you like its potential. The ONLY way for you to realize
  626.           this potential is  for you to work with  ALPHA by using
  627.           its (and not your own) statements.
  628.  
  629.           Therefore, you  should always use  an ALPHA command  to
  630.           update  a  variable  rather  than  directly  updating a
  631.           variable (ie, TextAttr and  LastPage). In addition, you
  632.           should  always use  one of  the Echo  Statements rather
  633.           than the CRT's WRITE statements.  (The CRT uses the RTL
  634.           library to  work some direct video  magic to change how
  635.           the  WRITE statement  functions. ALPHA  does not affect
  636.           the RTL.)
  637.  
  638.           You must also bit the bullet,  so to speak, and write a
  639.           few scratch programs to  learn how ALPHA works. Merely,
  640.           adding ALPHA as just another unit will not guarantee
  641.  
  642.     Page 13                                                      11-02-91
  643.  
  644.  
  645.           you success; if your program contains its own competing
  646.           statements!!! Using ALPHA means that you will no longer
  647.           have to write certain routines in your program.
  648.  
  649.           So  work  with  ALPHA,  and   NOT  against  it  by  NOT
  650.           substituting your own procedures.
  651.  
  652.  
  653.      ENUMERATED TYPES
  654.  
  655.           CursorShapes  = ( OFF, ON, BLOCK);
  656.           ----------------------------------
  657.           The screen cursor on each  of the eight video pages can
  658.           be  one of  these types.  You set  the cursor  with the
  659.           CURSOR statement.
  660.  
  661.  
  662.           Pages = ( FIRST,SECOND,THIRD,FOURTH,FIFTH,SIXTH,SEVENTH,EIGHTH );
  663.           -----------------------------------------------------------------
  664.           This type lists all the permitted video pages. However,
  665.           using pages FIFTH through EIGHTH is not recommended nor
  666.           will ALPHA ensure adapter compatibility.
  667.  
  668.  
  669.           Bkgrd = ( Black8, Blue8,    Green8, Cyan8,
  670.                     Red8,   Magenta8, Brown8, White8);
  671.           --------------------------------------------
  672.           The eight background colors  permitted in CGA_MODE. Use
  673.           them in conjunction with the special Change8 commands.
  674.  
  675.  
  676.           EgaRows  = ( at43, at50 );
  677.           --------------------------
  678.           The  row  options available  on  an  Ega/Vga  adapter in
  679.           Font8x8 Text mode.
  680.  
  681.  
  682.           AlphaChoices  = ( No_AlphaExit,
  683.                             No_MainExit,
  684.                             Cga_Mode,
  685.                             Ega_Mode,
  686.                             Cga16_Mode );
  687.           ------------------------------------
  688.           These   are  the   ALPHA   options   available  to  the
  689.           programmer.    Selections    are    made    with    the
  690.           MakeAlphaChoice command.
  691.  
  692.  
  693.           VideoCards = ( NOCARD, MDA, CGA, EGA, PGA, VGA, MCGA );
  694.           -------------------------------------------------------
  695.           These  are   the  types  of   video  adapters  reported
  696.           installed by ALPHA.
  697.  
  698.     Page 14                                                      11-02-91
  699.  
  700.  
  701.      CRT VARIABLES SUPPORTED
  702.  
  703.           TextAttr: byte;
  704.           ---------------
  705.           This  variable was  provided to  maintain compatibility
  706.           with  the CRT  unit. While  possible to  directly alter
  707.           this  variable, it  is not  recommended. Doing  so will
  708.           result in  a program that is  incompatible with certain
  709.           video adapters. There is only one TextAttr that is used
  710.           by all eight Video Pages.
  711.  
  712.           Think of it  as a scratch pad that  holds the last used
  713.           Color  attribute value.  Most statements,  but not all,
  714.           use it  as the default color  attribute to be displayed
  715.           to    the   screen.    The   Change    ,ReverseColorXY,
  716.           WriteCharOver, and DisplayOver statements ignore it.
  717.  
  718.  
  719.           LastMode: integer;
  720.           ------------------
  721.           This  variable was  provided to  maintain compatibility
  722.           with the CRT unit. Considering  the fact that ALPHA has
  723.           an Exit  Procedure that will  restore the original  DOS
  724.           environment  and   the  CRT  unit   has  the  NormVideo
  725.           statement, this variable is of no real value.
  726.  
  727.  
  728.  
  729.      ADDED PUBLIC VARIABLES
  730.  
  731.           LastPage: Pages;
  732.           ----------------
  733.           The last/current  hidden page being updated.  It is not
  734.           recommended  that  you  directly  update this variable.
  735.           Access it  instead through the  SetPage and PreparePage
  736.           commands.  Your  program  will  start out automatically
  737.           using the first video page.
  738.  
  739.  
  740.           LastProc: Pointer;
  741.           ------------------
  742.           The variable  points to the Optional  Main Program Exit
  743.           Procedure.
  744.  
  745.     Page 15                                                      11-02-91
  746.  
  747.  
  748.      CRT FUNCTIONS SUPPORTED
  749.  
  750.           Procedure ClrEol;
  751.           -----------------
  752.           Clears row from cursor position to the end of the line.
  753.  
  754.  
  755.           Procedure DelLine;
  756.           ------------------
  757.           Deletes the row under the cursor.
  758.  
  759.  
  760.           Procedure HighVideo;
  761.           --------------------
  762.           Filters  the current  foreground value  of TextAttr  so
  763.           that 8 is add to all foregrounds less than eight.
  764.  
  765.           Procedure InsLine;
  766.           ------------------
  767.           Inserts a blank row above the cursor.
  768.  
  769.  
  770.           Procedure LowVideo;
  771.           -------------------
  772.           Turns HighVideo off.
  773.  
  774.  
  775.           Procedure NormVideo;
  776.           --------------------
  777.           Restores  the TextAttr  variable to  the Starting Color
  778.           Attribute value.
  779.  
  780.  
  781.           Procedure TextBackground( Color: byte);
  782.           ---------------------------------------
  783.           Changes  the  background  color  value  stored  in  the
  784.           variable TextAttr.  You would use this  variable if you
  785.           were  planning to  Display a  new text  value and  only
  786.           wanted to have a different background color.
  787.  
  788.  
  789.           Procedure TextColor( Color: byte);
  790.           ----------------------------------
  791.           Changes  the  foreground  color  value  stored  in  the
  792.           variable TextAttr.  You would use this  variable if you
  793.           were  planning to  Display a  new text  value and  only
  794.           wanted to have a different foreground color.
  795.  
  796.     Page 16                                                      11-02-91
  797.  
  798.  
  799.           Procedure TextMode( Mode: integer);
  800.           -----------------------------------
  801.           Changes the current textmode. Use the standard CRT text
  802.           mode constants.
  803.  
  804.  
  805.           Function  WhereX: byte;
  806.           -----------------------
  807.           Returns the row position of the cursor.
  808.  
  809.  
  810.           Function  WhereY: byte;
  811.           -----------------------
  812.           Returns the column position of the cursor.
  813.  
  814.     Page 17                                                      11-02-91
  815.  
  816.  
  817.      ADDED FUNCTIONS
  818.  
  819.           Following  the TextAttr  method used  in the  CRT unit,
  820.           color  is  selected  separately  rather  than  on every
  821.           command. Likewise, ALPHA uses  the same method both for
  822.           color attributes and for video pages.
  823.  
  824.           All commands are in reference  to the value of LastPage
  825.           except for SetActivePage  and GetActivePage. Therefore,
  826.           LastPage must  be set to the  value of GetActivePage if
  827.           you want to reference values on the displayed screen.
  828.  
  829.           Procedure AltPrintScr;
  830.           ----------------------
  831.           For   Ega/Vga   adapters   it   selects   an  alternate
  832.           print-screen routine that works  properly if the screen
  833.           length   is  not   25  rows.   The  ROM   BIOS  default
  834.           print-screen routines always prints 25 lines.
  835.  
  836.  
  837.           Procedure Change8ColorXY( X,Y,Len,Foreground: Byte;
  838.                                     Background: Bkgrd);
  839.           ---------------------------------------------------
  840.           A special CGA_MODE version of ChangeColor that uses the
  841.           compiler to  catch background color errors.  It is also
  842.           faster.
  843.  
  844.  
  845.           Procedure Change8BackgroundXY( X,Y,Len: byte; Color: Bkgrd);
  846.           ------------------------------------------------------------
  847.           A special  CGA_MODE version of  ChangeBackgroundXY that
  848.           uses the compiler to  catch background color errors. It
  849.           is also faster.
  850.  
  851.  
  852.           Procedure ChangeColorXY( X,Y,Len,Foreground, Background: byte);
  853.           ---------------------------------------------------------------
  854.           Retains  text values  but changes  both foreground  and
  855.           background color at screen position X,Y for a length of
  856.           LEN.
  857.  
  858.  
  859.           Procedure ChangeBackgroundXY( X,Y,Len,Color: byte);
  860.           ---------------------------------------------------
  861.           Retains text  values but changes  ONLY background color
  862.           at screen position X,Y for a length of LEN.
  863.  
  864.     Page 18                                                      11-02-91
  865.  
  866.  
  867.           Procedure ChangeForegroundXY( X,Y,Len,Color: byte);
  868.           ---------------------------------------------------
  869.           Retains text  values but changes  ONLY foreground color
  870.           at screen position X,Y for a length of LEN.
  871.  
  872.  
  873.           Procedure Cursor( Shape: CursorShapes);
  874.           ---------------------------------------
  875.           Turns the cursor ON, OFF, or selects a BLOCK cursor.
  876.  
  877.  
  878.           Procedure Echo( S: string);
  879.           ---------------------------
  880.           Displays  the  string  S  on  the  screen at the cursor
  881.           position while  echoing the string  to standard output.
  882.           This command provides for redirection.
  883.  
  884.  
  885.           Procedure EchoLn( S: string);
  886.           -----------------------------
  887.           Displays  the  string  S  on  the  screen at the cursor
  888.           position while  echoing the string  to standard output.
  889.           And, moves the cursor to  the beginning position of the
  890.           following row.  This command provides  for redirection.
  891.  
  892.  
  893.           Procedure Display( X,Y: byte; S: string);
  894.           -----------------------------------------
  895.           Displays the string S on the screen at position X,Y.
  896.  
  897.  
  898.           Procedure DisplayOver( X,Y: byte; S: string);
  899.           ---------------------------------------------
  900.           Displays the S on the screen at position X,Y while using
  901.           the current screen colors at those positions.
  902.  
  903.  
  904.           Procedure EndofLine;
  905.           --------------------
  906.           Positions cursor on the last column of the current row.
  907.  
  908.  
  909.           Procedure FillPage( Ch: Char);
  910.           ------------------------------
  911.           Fills the screen with character CH.
  912.  
  913.  
  914.           Function  GetActivePage: Pages;
  915.           -------------------------------
  916.           Returns the page currently being displayed on screen.
  917.  
  918.     Page 19                                                      11-02-91
  919.  
  920.  
  921.           Function  GetBackGround( ColorAttr: byte): byte;
  922.           ------------------------------------------------
  923.           Returns the background color of a color attribute byte.
  924.  
  925.  
  926.           Function  GetForeGround( ColorAttr: byte): byte;
  927.           ------------------------------------------------
  928.           Returns the foreground color of a color attribute byte.
  929.  
  930.           Procedure GetBoth( var ColorAttr: byte; CH: char);
  931.           --------------------------------------------------
  932.           Enables  you to  get both  the color  attribute and the
  933.           character in one command.
  934.  
  935.  
  936.           Function  GetColorAttr: byte;
  937.           -----------------------------
  938.           Returns  the   color  attribute  byte   at  the  cursor
  939.           position.
  940.  
  941.  
  942.           Function  GetChar: char;
  943.           ------------------------
  944.           Returns the character at the cursor position.
  945.  
  946.  
  947.           Procedure GotoX( X: byte);
  948.           --------------------------
  949.           Moves  cursor  to  Row  X  while  remaining in the same
  950.           column.
  951.  
  952.  
  953.           Procedure GotoY( Y: byte);
  954.           --------------------------
  955.           Moves  the cursor  to Column  Y while  remaining in the
  956.           same row.
  957.  
  958.  
  959.           Procedure Home;
  960.           ---------------
  961.           Moves the cursor to the starting column while remaining
  962.           in the same row.
  963.  
  964.  
  965.           Procedure MakeAlphaChoice( Text: TextChoices);
  966.           ----------------------------------------------
  967.           How  the  programmer  can   select  the  various  ALPHA
  968.           options.
  969.  
  970.     Page 20                                                      11-02-91
  971.  
  972.  
  973.           Function  MaxCols: byte;
  974.           ------------------------
  975.           Returns the number of columns on the screen.
  976.  
  977.  
  978.           Function  MaxRows: byte;
  979.           ------------------------
  980.           Returns the number of rows on the screen.
  981.  
  982.  
  983.           Procedure   Prepare8Page(  P:   Pages;C:  CursorShapes;
  984.                             Foreground: byte; Background: Bkgrd);
  985.           -------------------------------------------------------
  986.           A high  level routine that performs  a number of common
  987.           procedures. It executes SetPage, Cursor, Set8Color, and
  988.           Cls using the CRT_MODE special 8 option.
  989.  
  990.  
  991.           Procedure PreparePage( P: Pages;C: CursorShapes; Foreground,
  992.                                  Background: byte);
  993.           ------------------------------------------------------------
  994.           A high  level routine that performs  a number of common
  995.           procedures. It executes  SetPage, Cursor, SetColor, and
  996.           Cls.
  997.  
  998.  
  999.           Procedure ReverseColorXY( X,Y,Len: byte);
  1000.           -----------------------------------------
  1001.           Swaps  the  color  attribute  value  of  foreground and
  1002.           background  color starting  at screen  position X,Y for
  1003.           length LEN.  It does not change TextAttr.
  1004.  
  1005.  
  1006.           Procedure Set8Color( Foreground: byte; Background: Bkgrd);
  1007.           ----------------------------------------------------------
  1008.           A special CGA_MODE version of SetColor that uses the
  1009.           compiler to  catch background color errors.  It is also
  1010.           faster.
  1011.  
  1012.  
  1013.           Procedure SetColor( Foreground, Background: byte);
  1014.           --------------------------------------------------
  1015.           Changes  both the  foreground and  background colors of
  1016.           the TextAttr.  Avoids the need for  using TextColor and
  1017.           TextBackground sequentially.
  1018.  
  1019.  
  1020.           Procedure SetActivePage( Num: Pages);
  1021.           -------------------------------------
  1022.           Displays the video page Num on the screen.
  1023.  
  1024.  
  1025.           Procedure SetBorder( Color: byte);
  1026.           ----------------------------------
  1027.           Changes  the  Border  color  on  all  CGA, EGA, and VGA
  1028.           monitors.
  1029.  
  1030.     Page 21                                                      11-02-91
  1031.  
  1032.  
  1033.           Procedure SetEgaLines( Num: VgaRows);
  1034.           -------------------------------------
  1035.           Sets the Ega scan lines on Ega and above monitors.
  1036.  
  1037.  
  1038.           Procedure SetPage( P: Pages);
  1039.           -----------------------------
  1040.           Allows  you to  write to  the hidden  page P.  Use this
  1041.           command  instead  of  directly  changing  the  LastPage
  1042.           Variable as it works with MONO and CGA adapters.
  1043.  
  1044.           MONO adapters  are forced to  used ONLY the  first page
  1045.           and CGA  adapters for pages  over four have  the number
  1046.           4 subtracted from P.
  1047.  
  1048.  
  1049.           Procedure TerminateOn( V: VideoCards);
  1050.           --------------------------------------
  1051.           A built  in routine that terminates  the program if the
  1052.           installed video  adapter is equal to  V, and displays a
  1053.           message  stating  that   the  succeeding  VideoCard  is
  1054.           required.
  1055.  
  1056.  
  1057.           Function  VideoAdapter: VideoCards;
  1058.           -----------------------------------
  1059.           Returns the installed video adapter.
  1060.  
  1061.  
  1062.           Procedure WhereXY( var X,Y: byte);
  1063.           ----------------------------------
  1064.           Returns the X,Y screen position of the cursor.
  1065.  
  1066.  
  1067.           Procedure WriteCharOver( Ch: char; Num: word);
  1068.           ----------------------------------------------
  1069.           Writes the  Character CH at the  current cursor position
  1070.           Num number of times using  the current screen colors at
  1071.           those positions.
  1072.  
  1073.     Page 22                                                      11-02-91
  1074.  
  1075.  
  1076.      BONUS STRING FUNCTIONS
  1077.  
  1078.           Function  Color2Str( Color: byte): str16;
  1079.           -----------------------------------------
  1080.           Converts a color constant into a color name string.
  1081.  
  1082.           Function  Int2Str( Num: longint; Width: byte): str80;
  1083.           -----------------------------------------------------
  1084.           Converts a whole number into a string of WIDTH length.
  1085.  
  1086.  
  1087.           Function  Real2Str( Num:  real; Width,Decimals: byte): str80;
  1088.           -------------------------------------------------------------
  1089.           Converts a real number into  a string with Decimals of
  1090.           WIDTH length.
  1091.  
  1092.  
  1093.           Function  Pages2Str( P: Pages): str7;
  1094.           -------------------------------------
  1095.           Converts  the  enumerated  type  Pages  into a string
  1096.           value.
  1097.  
  1098.  
  1099.           Function  VideoAdapter2Str( V: Videocards): Str4;
  1100.           -------------------------------------------------
  1101.           Converts the VideoCards type into a string value.
  1102.  
  1103.     Page 23                                                      11-02-91
  1104.  
  1105.  
  1106.      PRODUCT SUPPORT
  1107.  
  1108.           This product  is supported by the  author via a product
  1109.           support  echo  on  a  24  hour  a  day BBS. First, time
  1110.           callers  may   download  the  latest   versions  of  my
  1111.           products.
  1112.  
  1113.           You can  contact me by data  phone (8N1 1200/2400 BAUD)
  1114.           at:
  1115.  
  1116.                      ╔═══════════════════════════════╗
  1117.                      ║        The FreeBoard BBS      ║
  1118.                      ║         (804)744-0744         ║
  1119.                      ║          Richmond, Va.        ║
  1120.                      ╚═══════════════════════════════╝
  1121.  
  1122.           The FreeBoard BBS is a  multi-node RBBS-PC board on the
  1123.           Fido Net Work with over 400 MEG's of files.
  1124.  
  1125.           And, of course, you can ask  your SYSOP to FREQ this or
  1126.           any  other files  from  this  board with  the following
  1127.           info:
  1128.  
  1129.                1:264/212,The_FreeBoard_BBS,Midlothian_VA,Bill_Hunter,
  1130.                1-804-744-0797,9600,CM,XX,LO,HST
  1131.  
  1132.  
  1133.           The support  echo is called LZE-WC.  You arrive at this
  1134.           conference from the MAIN menu by joining it as follows:
  1135.  
  1136.                J
  1137.                LZE-WC
  1138.  
  1139.           The author may also be contacted by writing to:
  1140.  
  1141.                     JOHN GOHDE
  1142.                     ALPHA
  1143.                     P O BOX 17581
  1144.                     RICHMOND, VA 23226-7581
  1145.  
  1146.           If you  expect a response,  be sure to  include  a self
  1147.           addressed and stamped return envelop!
  1148.  
  1149.  
  1150.     Page 24                                                      11-02-91
  1151.  
  1152.  
  1153.      UPDATE HISTORY
  1154.  
  1155.  
  1156.  
  1157.           VERSION 1.00 -- originally released on 11-02-91
  1158.  
  1159.  
  1160.